package cn.donting.jme.edit.ui.scenetree.meum.geometry;

import cn.donting.jme.edit.ui.scenetree.ClipBoard;
import cn.donting.jme.edit.ui.scenetree.SceneTreeNodeView;
import cn.donting.jme.edit.ui.scenetree.meum.AbsTreeMenuItem;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class NodeMenuItem extends AbsTreeMenuItem {

    public NodeMenuItem() {
        super("节点");
    }

    @Override
    public boolean isAvailable(ClipBoard clipBoard) {
        Spatial selectSpatial = clipBoard.getSelectSpatial();
        if (selectSpatial instanceof Node) {
            return true;
        }
        return false;
    }
    @Override
    public void action(ClipBoard clipBoard) {
        Node newNode = new Node("new Node");
        SceneTreeNodeView instance = SceneTreeNodeView.getInstance();
        instance.addSpatialToSelectNode(newNode);
    }
}
